import React, {useState} from 'react';
import {getToken} from "../../utils/token";
import {Modal} from "antd";

const LoginAlert = (props) => {
    const token = getToken()
    const [isModalOpen, setIsModalOpen] = useState(props.open)


    const handleOk = () => {
        setIsModalOpen(false);
    }
    const handleCancel = () => {
        setIsModalOpen(false);
    }
    return (
        <div>
            {
                token ? null :
                    <Modal
                        maskStyle={{backgroundColor:'rgba(0,0,0,.1)'}}
                        centered
                           open={isModalOpen}
                           onOk={handleOk}
                           okText="确认"
                           cancelText="取消"
                           onCancel={handleCancel}>
                      <p>请先进行登录</p>
                    </Modal>
            }
        </div>
    );
};

export default LoginAlert;